Skip to content

Own Device Farm launch inputs in SDK plugin - #59

Merged
Chinmay-KB merged 4 commits into
mainfrom
codex/tugboat-device-farm-sdk
Sep 4, 2026
Merged

Own Device Farm launch inputs in SDK plugin#59
Chinmay-KB merged 4 commits into
mainfrom
codex/tugboat-device-farm-sdk

Conversation

@Chinmay-KB

Copy link
Copy Markdown
Collaborator

Summary

Host apps needed hand-written native code to receive Device Farm launch flags (Android Intent extras + iOS process environment) plus Dart-side parsing, URL policy, and endpoint resolution. This moves all of it into the SDK so hosts get it for free:

  • tugboat/launch#getLaunchOptions on TugboatPlugin (Android reads Intent extras, iOS reads TUGBOAT_* process environment). Natives pass raw strings through; key contract unchanged (tugboat_emit_scene_inventory, tugboat_accept_action_context, tugboat_collector_base_url / TUGBOAT_*).
  • New TugboatLaunchOptions.fromPlatform() (never throws, injectable channel), TugboatLaunchParsers (single 1/true/yes + local-only http policy), resolveTugboatCollectorBaseUrl() (runtime > build > fallback; release always prod).
  • TugboatReplayConfig.withDeviceFarmOverrides(): additive merge (ORs capabilities, swaps collector base URL only for validated local URLs in debug) plus one TUGBOAT_LAUNCH debug line with no secrets.
  • TugboatCollectorConfig.withBaseUrl() helper + CHANGELOG entry.

Validation

  • bash tool/ci/run-flutter-tests.sh tugboat: 415 passed (10 new in test/launch_options_test.dart)
  • dart analyze sdks/flutter/packages/tugboat: clean (one pre-existing info)
  • git diff --check: clean
  • Farm-proven on AWS Device Farm (Pixel 7a, Android 13): release APK launched with --ez extras logged TUGBOAT_LAUNCH {captureRequested:true,...} and TUGBOAT_HEALTH {lifecycle:active, sinks.accepted:34} against the production collector.

Compatibility

Additive only. No existing API changed; hosts keep working untouched and can adopt withDeviceFarmOverrides() (or read TugboatLaunchOptions directly) when ready.

Expose getLaunchOptions on the tugboat/launch channel from TugboatPlugin
(Android Intent extras, iOS process environment) so host apps need no
native code. Add TugboatLaunchOptions, TugboatLaunchParsers (single
bool/local-URL policy), resolveTugboatCollectorBaseUrl (release-guarded),
and TugboatReplayConfig.withDeviceFarmOverrides for one-call merge.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T09:05:06.659032Z 70e5e9f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70e5e9f2ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

factory TugboatLaunchOptions.fromMap(Map<String, Object?> values) {
final rawBaseUrl = values[keyCollectorBaseUrl] as String?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle malformed launch payloads without throwing

When a mismatched native plugin or injected channel returns a non-String collectorBaseUrl, this cast throws a TypeError; a scalar or incorrectly typed map can similarly fail inside invokeMapMethod. Because fromPlatform() catches only MissingPluginException and PlatformException, withDeviceFarmOverrides() then fails during startup instead of returning defaults as its “unexpected payload” contract promises. Decode the payload defensively or also handle payload-shape errors.

Useful? React with 👍 / 👎.

Use a typed launchValue helper (String? ?? NSNull never inferred) and add
MethodChannel-mocked fromPlatform tests. Verified on iPhone 17 simulator:
SIMCTL_CHILD_TUGBOAT_* env decodes to enabled capabilities; absent env
decodes to off.
@Chinmay-KB
Chinmay-KB merged commit c84e95f into main Sep 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant